home *** CD-ROM | disk | FTP | other *** search
- Path: doc.ic.ac.uk!not-for-mail
- From: mdf@doc.ic.ac.uk (Martin Frost)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: 3 bugs in SAS/C v. 6.56
- Date: 1 Mar 1996 13:25:24 -0000
- Organization: Dept. of Computing, Imperial College, University of London, UK.
- Distribution: world
- Message-ID: <4h6ts4$ldq@oak43.doc.ic.ac.uk>
- References: <4gjvvc$a3t@gjallar.daimi.aau.dk>
- Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
- NNTP-Posting-Host: oak43.doc.ic.ac.uk
- Keywords: SAS/C,bug
- X-Newsreader: mxrn 6.18-23
-
-
- In article <4gjvvc$a3t@gjallar.daimi.aau.dk>, liborius@daimi.aau.dk (Per Liboriussen) writes:
- >union un {
- > const char *cp;
- > char *p;
- >};
-
- >const char *foo(union un *unp, int n)
- ^^^^^
- >{
- > return (n ? unp->p : unp->cp);
- >}
-
- By returning unp->p from foo(), you are returning a char * where const char *
- is specified. The compiler should probably flag this as the error.
- As assigning to unp->p causes the error, I think that the compiler has
- redefined unp->p as a const char * to fit the return type of foo(). Your
- program is not entirely correct, so you can't really complain.
-
- Try removing the const and see if the problem goes away.
-
- Martin
-